Skip to content

fix(grid): structural styles, scrolling and filter row in a shadow root - 22.3.x - #18098

Open
rkaraivanov wants to merge 2 commits into
22.3.xfrom
rkaraivanov/fix-grid-shadow-root-22.3.x
Open

rkaraivanov wants to merge 2 commits into
22.3.xfrom
rkaraivanov/fix-grid-shadow-root-22.3.x

Conversation

@rkaraivanov

Copy link
Copy Markdown
Member

Closes #17859, closes #17860

Description

  • IgxStylesRegistrar.register() takes an optional host. The sheet is still adopted by the document. When host.getRootNode() is a ShadowRoot that does not have the sheet yet, the same sheet is adopted by that shadow root too.
  • IgxGridBaseDirective registers its structural sheet in ngOnInit with its element, instead of in the constructor without one. retain() stays in the constructor.
  • IgxForOfDirective.onScroll / onHScroll and IgxGridForOfDirective.onScroll read the scroll position from their scroll element instead of event.target.
  • IgxGridFilteringRowComponent reads its input element instead of event.target when the debounced input is handled.

Motivation / Context

This is the port of # to 22.3.x. The code is the same as in the master pull request. igniteui-webcomponents-grids 7.4, which uses igniteui-i18n-core 2, is built from this line, so this port is the one that #18088 needs.

One conflict was resolved in grid.component.spec.ts: this branch has no "transitions of the cell content" block, so only the new "in a shadow root" block was added there. The changelog entries are under 22.3.2.

Type of Change (check all that apply):

  • Bug fix
  • Tests
  • Changelog

Component(s) / Area(s) Affected:

Grid, Tree Grid, Hierarchical Grid, Pivot Grid, igxFor, IgxStylesRegistrar, Elements

How Has This Been Tested?

  • Unit tests

The same new specs as in the master pull request. Each one fails without the fix:

  • styles in a shadow root: registrar (7 specs), grid, Elements;
  • throttled scroll in a shadow root;
  • filter row in a shadow root;
  • the two "scroll throttle trailing edge" specs, which now stub scrollTop on the scroll element.

Runs on this branch, with the node_modules of its own lock file:

  • registrar, grid, pivot grid and igxFor specs: 2387 of 2387;
  • igniteui-angular-elements: 96 of 96;
  • lint of the changed files: 0 errors.

Test Configuration:

  • Angular version: 22.2.3
  • Browser(s): Chromium 156 (Vitest browser mode)
  • OS: Linux (WSL2)

Checklist:

  • All relevant labels have been applied to this PR
  • This PR includes unit tests covering all the new code (test guidelines)
  • This PR includes API docs for newly added methods/properties (api docs guidelines)
  • This PR includes CHANGELOG.MD updates for newly added functionality

🤖 Generated with Claude Code

rkaraivanov and others added 2 commits December 4, 2026 13:17
The grid's structural stylesheet was adopted by the document only, so a
grid in a shadow root (a custom element or a ShadowDom component) had no
layout. IgxStylesRegistrar.register() takes an optional host and also
adopts the sheet into the host's shadow root. The grid registers in
ngOnInit, once its element is attached, also inside @if or @for.

Closes #17859
Part of #18088

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The vertical scroll handler runs after a throttle and the filter row
input handler after a debounce. In a shadow root the browser clears the
event target when the dispatch ends, so reading event.target threw and
the rows did not follow the scrollbar or the filter was not applied.
The for-of directives read the scroll element and the filter row reads
its input element instead.

Closes #17860
Part of #18088

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rkaraivanov
rkaraivanov requested review from mddragnev and simeonoff and a balanced review from Copilot December 4, 2026 11:44
@rkaraivanov rkaraivanov changed the title Rkaraivanov/fix grid shadow root 22.3.x fix(grid): structural styles, scrolling and filter row in a shadow root - 22.3.x Dec 4, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A pending text-filter debounce can dereference an undefined input and throw if the user switches to a Date or Time column before it expires.

1 open issue
What changed in this PR

Backports shadow-root grid fixes to 22.3.x, supporting the Web Components release needed for shared localization.

Changes:

  • Adopts grid structural styles into the containing shadow root.
  • Reads scroll and filter values from elements rather than deferred event targets.
  • Adds regression coverage and release notes.
File Description
projects/​igniteui-angular/​test-utils/​grid-samples.spec.ts Adds a shared shadow-root grid fixture.
projects/​igniteui-angular/​grids/​grid/​src/​grid.component.spec.ts Tests shadow-root layout and throttled scrolling.
projects/​igniteui-angular/​grids/​grid/​src/​grid-filtering-row.spec.ts Tests shadow-root filtering.
projects/​igniteui-angular/​grids/​grid/​src/​grid-base.directive.ts Registers styles during initialization with the grid host.
projects/​igniteui-angular/​grids/​core/​src/​filtering/​base/​grid-filtering-row.component.ts Reads the filter input directly.
projects/​igniteui-angular/​directives/​src/​directives/​for-of/​for_of.directive.ts Reads positions from scroll elements.
projects/​igniteui-angular/​core/​src/​services/​styles/​styles-registrar.service.ts Adds host-aware shadow-root stylesheet adoption.
projects/​igniteui-angular/​core/​src/​services/​styles/​styles-registrar.service.spec.ts Covers host-aware registration.
projects/​igniteui-angular-elements/​src/​app/​custom-strategy.spec.ts Tests grid styles inside an Elements shadow root.
CHANGELOG.md Documents the fixes and registrar API extension.

Review effort: Balanced

const target = (eventArgs as InputEvent).target as HTMLInputElement;
// Read the input, not the event target: the debounced call runs after the dispatch, when the browser
// has cleared the target of an event in a shadow tree.
const target = this.input.nativeElement;

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants